import { type Request, type Response } from "express";

import { Gateway, getGateway } from "@/droplet-bus/core.define";

import { app_gateway } from "./core.local";

export const UserPasswordGateway: Gateway = getGateway(app_gateway, "stream_user_password");
export type patchUserPasswordDto = { accountNumber: string; password: string };
export type doUserPasswordLoginDto = { accountNumber: string; password: string };

export interface UserPasswordInterface<T> {
  /** 超级管理员/账号自己修改登录密码 */
  patchUserPassword(dto: T & patchUserPasswordDto): Promise<null>;

  /** 通过密码登录 */
  doUserPasswordLogin(dto: T & doUserPasswordLoginDto): Promise<{ SessionId: string }>;
}

export interface UserPasswordInterfaceInServer<T> {
  /** 超级管理员/账号自己修改登录密码 */
  patchUserPassword(HeaderSessionId: string, request: Request, dto: T & patchUserPasswordDto): Promise<null>;

  /** 通过密码登录 */
  doUserPasswordLogin(response: Response, dto: T & doUserPasswordLoginDto): Promise<{ SessionId: string }>;
}
